package com.algorithm.string_and_array;

import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

@Slf4j
public class ArraySolutionLC05 {
    public int searchInsert(int[] nums, int target) {
        int a = nums.length;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i]>=target){
                a = i;
                return a;
            }
        }
        return a;
    }


    @DisplayName("搜索插入位置")
    @Test
    public void test(){
        int [] nums = {1,3,5,6};
        int i = searchInsert(nums, 7);
        log.info("this is result {}",i);
    }
}
